package com.banciyuan.bcywebview.base.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.banciyuan.bcywebview.R;
import com.banciyuan.bcywebview.utils.regex.MyLinkfy;
import com.banciyuan.bcywebview.utils.regex.MyRegex;
import com.banciyuan.bcywebview.utils.string.UnderLineUtil;

public class CustomServieDialog extends Dialog {
    private Button confirm_btn;
    private TextView tv_log;
    private View.OnClickListener onConfirmClickListener;

    public CustomServieDialog(Context context) {
        super(context);
    }

    public CustomServieDialog(Context context, int theme) {
        super(context, theme);
    }

    protected CustomServieDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    public void setOnConfirmClickListener(View.OnClickListener onConfirmClickListener) {
        this.onConfirmClickListener = onConfirmClickListener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.custom_service_dialog);
        confirm_btn = (Button) findViewById(R.id.confirm_btn);
        tv_log = (TextView) findViewById(R.id.tv_log);
        MyLinkfy.addLinks(tv_log, MyRegex.plist.get(2), "bcyapp_");
        UnderLineUtil.DisUnderLine(getContext(), tv_log, "bcyapp_" + getContext().getString(R.string.zhipin_helper));
        confirm_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (null != onConfirmClickListener) {
                    onConfirmClickListener.onClick(view);
                }
                dismiss();
            }
        });
    }
}
